﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using devtm.Collections;

namespace devtm.Editor.TypeSelector.AttributeBuilder
{

    /// <summary>
    /// Gere la liste des proprietes ppour un type
    /// </summary>
    public class Parameters : devtm.Collections.TableCollection<Parameter, string>
    {
        private Type _type;
        private devtm.Collections.ViewCollection<Parameter, string> view;

        public Parameters() : base(c => c.Name)
        {

        }

        public Type Type
        {

            get { return _type; }
            set
            {

                _type = value;
                this.Clear();

                view = this.GetView(c => IsInList(c));
                PropertyChange("Type");

            }
        }

        private bool Accept(Type item)
        {
            if (item == typeof(string) || item == typeof(Type) || item.IsEnum || item.IsPrimitive)
                return true;

            return false;
        }


        private bool IsInList(Parameter c)
        {

            //if (c.Context == 0)
            //    return true;

            //foreach (Parameter item in this)
            //{

            //}

            return true;
        }


        public object GetListe
        {
            get
            {
                return view;
            }

        }


    }
}
